package com.fp.m7.client.event;

import com.fp.m7.shared.dto.AccountDto;
import com.google.gwt.event.shared.GwtEvent;

/**
 * An event which will be displayed in InfoPresenter for the specified time.
 * 
 * @author 7
 */
public class AccountAuthenticatedEvent extends GwtEvent<AccountAuthenticatedEventHandler> {

    public static final Type<AccountAuthenticatedEventHandler> TYPE = new Type<AccountAuthenticatedEventHandler>();

    private AccountDto authenticatedAccount;

    public AccountAuthenticatedEvent() {
    }

    public AccountAuthenticatedEvent(AccountDto authenticatedAccount) {
        this.authenticatedAccount = authenticatedAccount;
    }

    @Override
    protected void dispatch(AccountAuthenticatedEventHandler handler) {
        handler.onAccountAuthenticated(this);
    }

    @Override
    public Type<AccountAuthenticatedEventHandler> getAssociatedType() {
        return TYPE;
    }

    public AccountDto getAuthenticatedAccount() {
        return authenticatedAccount;
    }

    public void setAuthenticatedAccount(AccountDto authenticatedAccount) {
        this.authenticatedAccount = authenticatedAccount;
    }

}